home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / entry.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  14.2 KB  |  460 lines

  1. '\"
  2. '\" Copyright 1990 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/entry.man,v 1.9 92/05/27 13:41:53 ouster Exp $ SPRITE (Berkeley)
  11. '/" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS entry cmds
  189. .BS
  190. '\" Note:  do not modify the .SH NAME line immediately below!
  191. .SH NAME
  192. entry \- Create and manipulate entry widgets
  193. .SH SYNOPSIS
  194. \fBentry\fI \fIpathName \fR?\fIoptions\fR?
  195. .SH "STANDARD OPTIONS"
  196. .LP
  197. .nf
  198. .ta 4c 8c 12c
  199. .VS
  200. \fBbackground\fR    \fBcursorOffTime\fR    \fBforeground\fR    \fBselectForeground\fR
  201. \fBborderWidth\fR    \fBcursorOnTime\fR    \fBrelief\fR    \fBtextVariable\fR
  202. \fBcursor\fR    \fBcursorWidth\fR    \fBscrollCommand\fR
  203. \fBcursorBackground\fR    \fBexportSelection\fR    \fBselectBackground\fR
  204. \fBcursorBorderWidth\fR    \fBfont\fR    \fBselectBorderWidth\fR
  205. .VE
  206. .fi
  207. .LP
  208. See the ``options'' manual entry for details on the standard options.
  209. .SH "WIDGET-SPECIFIC OPTIONS"
  210. .ta 4c
  211. .LP
  212. .nf
  213. .VS
  214. Name:    \fBstate\fR
  215. Class:    \fBState\fR
  216. Command-Line Switch:    \fB\-state\fR
  217. .fi
  218. .IP
  219. Specifies one of two states for the entry:  \fBnormal\fR or \fBdisabled\fR.
  220. If the entry is disabled then the value may not be changed using widget
  221. commands and no insertion cursor will be displayed, even if the input focus is
  222. in the widget.
  223. .VE
  224. .LP
  225. .nf
  226. Name:    \fBwidth\fR
  227. Class:    \fBWidth\fR
  228. Command-Line Switch:    \fB\-width\fR
  229. .fi
  230. .IP
  231. Specifies an integer value indicating the desired width of the entry window,
  232. in average-size characters of the widget's font.
  233. .BE
  234.  
  235. .SH DESCRIPTION
  236. .PP
  237. The \fBentry\fR command creates a new window (given by the
  238. \fIpathName\fR argument) and makes it into an entry widget.
  239. Additional options, described above, may be specified on the
  240. command line or in the option database
  241. to configure aspects of the entry such as its colors, font,
  242. and relief.  The \fBentry\fR command returns its
  243. \fIpathName\fR argument.  At the time this command is invoked,
  244. there must not exist a window named \fIpathName\fR, but
  245. \fIpathName\fR's parent must exist.
  246. .PP
  247. An entry is a widget that displays a one-line text string and
  248. allows that string to be edited using widget commands described below, which
  249. are typically bound to keystrokes and mouse actions.
  250. When first created, an entry's string is empty.
  251. A portion of the entry may be selected as described below.
  252. .VS
  253. If an entry is exporting its selection (see the \fBexportSelection\fR
  254. option), then it will observe the standard X11 protocols for handling the
  255. .VE
  256. selection;  entry selections are available as type \fBSTRING\fR.
  257. Entries also observe the standard Tk rules for dealing with the
  258. input focus.  When an entry has the input focus it displays an
  259. \fIinsertion cursor\fR to indicate where new characters will be
  260. inserted.
  261. .PP
  262. Entries are capable of displaying strings that are too long to
  263. fit entirely within the widget's window.  In this case, only a
  264. portion of the string will be displayed;  commands described below
  265. may be used to change the view in the window.  Entries use
  266. the standard \fBscrollCommand\fR mechanism for interacting with
  267. scrollbars (see the description of the \fBscrollCommand\fR option
  268. for details).  They also support scanning, as described below.
  269.  
  270. .SH "WIDGET COMMAND"
  271. .PP
  272. The \fBentry\fR command creates a new Tcl command whose
  273. name is \fIpathName\fR.  This
  274. command may be used to invoke various
  275. operations on the widget.  It has the following general form:
  276. .DS C
  277. \fIpathName option \fR?\fIarg arg ...\fR?
  278. .DE
  279. \fIOption\fR and the \fIarg\fRs
  280. determine the exact behavior of the command.
  281. .PP
  282. Many of the widget commands for entries take one or more indices as
  283. arguments.  An index specifies a particular character in the entry's
  284. string, in any of the following ways:
  285. .TP 12
  286. \fInumber\fR
  287. Specifies the character as a numerical index, where 0 corresponds
  288. to the first character in the string.
  289. .TP 12
  290. \fBcursor\fR
  291. Indicates the character adjacent to and immediately following the
  292. insertion cursor.
  293. .TP 12
  294. \fBend\fR
  295. Indicates the character just after the last one in the entry's string.
  296. This is equivalent to specifying a numerical index equal to the length
  297. of the entry's string.
  298. .TP 12
  299. \fBsel.first\fR
  300. Indicates the first character in the selection.  It is an error to
  301. use this form if the selection isn't in the entry window.
  302. .TP 12
  303. \fBsel.last\fR
  304. Indicates the last character in the selection.  It is an error to
  305. use this form if the selection isn't in the entry window.
  306. .TP 12
  307. \fB@\fInumber\fR
  308. In this form, \fInumber\fR is treated as an x-coordinate in the
  309. entry's window;  the character spanning that x-coordinate is used.
  310. For example, ``\fB@0\fR'' indicates the left-most character in the
  311. window.
  312. .LP
  313. Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR''
  314. or ``\fBsel.f\fR''.  In general, out-of-range indices are automatically
  315. rounded to the nearest legal value.
  316. .PP
  317. The following commands are possible for entry widgets:
  318. .TP
  319. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  320. Query or modify the configuration options of the widget.
  321. If no \fIoption\fR is specified, returns a list describing all of
  322. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  323. information on the format of this list).  If \fIoption\fR is specified
  324. with no \fIvalue\fR, then the command returns a list describing the
  325. one named option (this list will be identical to the corresponding
  326. sublist of the value returned if no \fIoption\fR is specified).  If
  327. one or more \fIoption\-value\fR pairs are specified, then the command
  328. modifies the given widget option(s) to have the given value(s);  in
  329. this case the command returns an empty string.
  330. \fIOption\fR may have any of the values accepted by the \fBentry\fR
  331. command.
  332. .TP
  333. \fIpathName \fBcursor \fIindex\fR
  334. Arrange for the insertion cursor to be displayed just before the character
  335. given by \fIindex\fR.  Returns an empty string.
  336. .TP
  337. \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
  338. Delete one or more elements of the entry.  \fIFirst\fR and \fIlast\fR
  339. are indices of of the first and last characters in the range to
  340. be deleted.   If \fIlast\fR isn't specified it defaults to
  341. \fIfirst\fR, i.e. a single character is deleted.  This command
  342. returns an empty string.
  343. .TP
  344. \fIpathName \fBget\fR
  345. Returns the entry's string.
  346. .TP
  347. \fIpathName \fBindex\fI index\fR
  348. Returns the numerical index corresponding to \fIindex\fR.
  349. .TP
  350. \fIpathName \fBinsert \fIindex string\fR
  351. Insert the characters of \fIstring\fR just before the character
  352. indicated by \fIindex\fR.  Returns an empty string.
  353. .TP
  354. \fIpathName \fBscan\fR \fIoption args\fR
  355. This command is used to implement scanning on entries.  It has
  356. two forms, depending on \fIoption\fR:
  357. .RS
  358. .TP
  359. \fIpathName \fBscan mark \fIx\fR
  360. Records \fIx\fR and the current view in the entry window;  used in
  361. conjunction with later \fBscan dragto\fR commands.  Typically this
  362. command is associated with a mouse button press in the widget.  It
  363. returns an empty string.
  364. .TP
  365. \fIpathName \fBscan dragto \fIx\fR
  366. This command computes the difference between its \fIx\fR argument
  367. and the \fIx\fR argument to the last \fBscan mark\fR command for
  368. the widget.  It then adjusts the view left or right by 10 times the
  369. difference in x-coordinates.  This command is typically associated
  370. with mouse motion events in the widget, to produce the effect of
  371. dragging the entry at high speed through the window.  The return
  372. value is an empty string.
  373. .RE
  374. .TP
  375. \fIpathName \fBselect \fIoption arg\fR
  376. This command is used to adjust the selection within an entry.  It
  377. has several forms, depending on \fIoption\fR:
  378. .RS
  379. .TP
  380. \fIpathName \fBselect adjust \fIindex\fR
  381. Locate the end of the selection nearest to the character given by
  382. \fIindex\fR, and adjust that end of the selection to be at \fIindex\fR
  383. (i.e including but not going beyond \fIindex\fR).  The other
  384. end of the selection is made the anchor point for future
  385. \fBselect to\fR commands.  If the selection
  386. isn't currently in the entry, then a new selection is created to
  387. include the characters between \fIindex\fR and the most recent
  388. selection anchor point, inclusive.
  389. Returns an empty string.
  390. .TP
  391. \fIpathName \fBselect clear\fR
  392. Clear the selection if it is currently in this widget.  If the
  393. selection isn't in this widget then the command has no effect.
  394. Returns an empty string.
  395. .TP
  396. \fIpathName \fBselect from \fIindex\fR
  397. Set the selection anchor point to just before the character
  398. given by \fIindex\fR.  Doesn't change the selection.
  399. Returns an empty string.
  400. .TP
  401. \fIpathName \fBselect to \fIindex\fR
  402. Set the selection to consist of the elements from the anchor
  403. point to element \fIindex\fR, inclusive.  The anchor point is
  404. determined by the most recent \fBselect from\fR or \fBselect adjust\fR
  405. command in this widget.  If the selection isn't in this widget
  406. then a new selection is created using the most recent anchor point
  407. specified for the widget.  Returns an empty string.
  408. .RE
  409. .TP
  410. \fIpathName \fBview \fIindex\fR
  411. Adjust the view in the entry so that element \fIindex\fR is
  412. at the left edge of the window.  Returns an empty string.
  413.  
  414. .SH "DEFAULT BINDINGS"
  415. .PP
  416. .VS
  417. Tk automatically creates class bindings for entries that give them
  418. the following default behavior:
  419. .IP [1]
  420. Clicking mouse button 1 in an entry positions the insertion cursor
  421. just before the character underneath the mouse cursor and sets the
  422. input focus to this widget.
  423. .IP [2]
  424. Dragging with mouse button 1 strokes out a selection between
  425. the insertion cursor and the character under the mouse.
  426. .IP [3]
  427. The ends of the selection can be adjusted by dragging with mouse
  428. button 1 while the shift key is down;  this will adjust the end
  429. of the selection that was nearest to the mouse cursor when button
  430. 1 was pressed.
  431. .IP [4]
  432. The view in the entry can be adjusted by dragging with mouse button 2.
  433. .IP [5]
  434. If the input focus is in an entry widget and characters are typed on the
  435. keyboard, the characters are inserted just before the insertion cursor.
  436. .IP [6]
  437. Control-h and the Backspace and Delete keys erase the character just
  438. before the insertion cursor.
  439. .IP [7]
  440. Control-w erases the word just before the insertion cursor.
  441. .IP [8]
  442. Control-u clears the entry to an empty string.
  443. .IP [9]
  444. Control-v inserts the current selection just before the insertion cursor.
  445. .IP [10]
  446. Control-d deletes the selected characters;  an error occurs if the selection
  447. is not in this widget.
  448. .PP
  449. If the entry is disabled using the \fBstate\fR option, then the entry's
  450. view can still be adjusted and text in the entry can still be selected,
  451. but no insertion cursor will be displayed and no text modifications will
  452. take place.
  453. .PP
  454. The behavior of entries can be changed by defining new bindings for
  455. individual widgets or by redefining the class bindings.
  456. .VE
  457.  
  458. .SH KEYWORDS
  459. entry, widget
  460.